Powershell Core 6.1 Cookbook by Jan-Hendrik Peters
Author:Jan-Hendrik Peters [Jan-Hendrik Peters]
Language: eng
Format: epub
Tags: COM088000 - COMPUTERS / System Administration / General, COM046000 - COMPUTERS / Operating Systems / General, COM005030 - COMPUTERS / Enterprise Applications / Business Intelligence Tools
Publisher: Packt
Published: 2019-04-18T08:11:41+00:00
Get-Service -Name $Name
After registering your new service, you could create another new cmdlet or use:
systemctl start polaris
How it works...
Unfortunately, the System.Service.ServiceController class that the Service cmdlets use is Windows-only. However, PowerShell Core still makes your life a lot easier, and the migration from Windows to Linux a lot more bearable, by allowing you to create your own custom cmdlets.
Again, as Linux is predominantly string-based, we are using regular expressions to parse the output of the Linux commands and simply convert them to proper objects. Observe how the match operator is used here—the $Matches variable is cloned, group 0 is removed and the resulting hash table is used as the parameter for your new object.
This recipe showed you how to use functions to create reusable code that wraps around operating system functionality. It is often necessary to extend existing functions, or create new ones in PowerShell, if nothing suitable exists. Reusable code such as Get-Service and New-Service can help you be productive on Windows and Linux.
Download
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.
Implementing Enterprise Observability for Success by Manisha Agrawal and Karun Krishnannair(7336)
Supercharging Productivity with Trello by Brittany Joiner(6598)
Secrets of the JavaScript Ninja by John Resig Bear Bibeault(6419)
Mastering Tableau 2023 - Fourth Edition by Marleen Meier(6354)
Inkscape by Example by István Szép(6214)
Visualize Complex Processes with Microsoft Visio by David J Parker & Šenaj Lelić(5911)
Build Stunning Real-time VFX with Unreal Engine 5 by Hrishikesh Andurlekar(4902)
Design Made Easy with Inkscape by Christopher Rogers(4595)
Customizing Microsoft Teams by Gopi Kondameda(4137)
Linux Device Driver Development Cookbook by Rodolfo Giometti(3935)
Extending Microsoft Power Apps with Power Apps Component Framework by Danish Naglekar(3725)
Business Intelligence Career Master Plan by Eduardo Chavez & Danny Moncada(3688)
Salesforce Platform Enterprise Architecture - Fourth Edition by Andrew Fawcett(3599)
Pandas Cookbook by Theodore Petrou(3580)
The Tableau Workshop by Sumit Gupta Sylvester Pinto Shweta Sankhe-Savale JC Gillet and Kenneth Michael Cherven(3385)
TCP IP by Todd Lammle(2983)
Drawing Shortcuts: Developing Quick Drawing Skills Using Today's Technology by Leggitt Jim(2910)
Applied Predictive Modeling by Max Kuhn & Kjell Johnson(2859)
Work Smarter with Microsoft OneNote by Connie Clark(2842)
